package com.itfitness.mchart.factory;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

/**
 * @ProjectName: MChart
 * @Package: com.itfitness.mchart.factory
 * @ClassName: DialogFactory
 * @Description: java类作用描述 ：弹窗工厂类
 * @Author: 作者名：lml
 * @CreateDate: 2019/4/24 14:12
 * @UpdateUser: 更新者：
 * @UpdateDate: 2019/4/24 14:12
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */

public class DialogFactory {
    /**
     * 创建默认的Dialog(带确定取消按钮的)
     * @param context
     * @param msg
     * @param positiveText
     * @param positiveListener
     * @param nagativeText
     * @param negativeListener
     * @return
     */
    public static AlertDialog createDefaultDialog(Context context, String msg,String positiveText,String nagativeText, DialogInterface.OnClickListener positiveListener,
                                                   DialogInterface.OnClickListener negativeListener){
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle("提示");
        builder.setMessage(msg);
        builder.setPositiveButton(positiveText,positiveListener);
        builder.setNegativeButton(nagativeText,negativeListener);
        return builder.create();
    }
}
